<?php
namespace app\admin\validate;
use think\Validate;
use think\Db;

class Increase extends Validate
{
	
	//验证规则
	protected $rule = [		
		'name' => 'require|min:2|max:12|chsAlphaNum',
		'id_number' => 'require|idCard',
		'mobile' => 'require|mobile',
		'company_id' => 'require|number',
		'start_date' => 'require|date',
		'wage' => 'require|gt:0',
		'bank_account' => 'number|max:50',
		'bank' => 'chsAlphaNum|max:50',
		'bank_number' => 'number|max:50',
	];
		
	
	//提示信息
	protected $message = [
		'name.require' => '姓名必须填写',
		'name.min' => '姓名最少不低于2个字符',
		'name.max' => '姓名最多不超过12个字符',
		'name.chsAlphaNum' => '姓名格式错误',
		
	
		'id_number.require' => '身份证号必须填写',
		'id_number.idCard' => '身份证号格式错误',
		
		'mobile.require' => '手机号必须填写',
		'mobile.mobile' => '手机号格式错误',						
				
		'company_id.require' => '公司必须选择',
		'company_id.number' => '公司格式错误',
		
		'start_date.require' => '起始时间必须选择',
		'start_date.date' => '起始时间格式错误',
		
		'wage.require' => '月发工资必须填写',
		'wage.gt' => '月发工资不能为0',
		
		'bank_account.number' => '银行卡号格式错误',
		'bank_account.max' => '银行卡号最多不超过50个字符',
		
		'bank.chsAlphaNum' => '开户银行格式错误',
		'bank.max' => '开户银行最多不超过50个字符',
		
		'bank_number.number' => '银行行号格式错误',
		'bank_number.max' => '银行行号最多不超过50个字符',
		
	];
	
	
	//验证场景
	protected $scene = [
		//增员
		'add'   => ['name','id_number','mobile','company_id','start_date','wage','bank_account','bank','bank_number'],
		//审核
		'examine' => ['name','id_number','mobile','start_date','wage','bank_account','bank','bank_number'],
		//导入验证姓名
		'import_name' => ['name'],
		//导入验证身份证号
		'import_id' => ['id_number'],
		//导入验证手机号
		'import_mobile' => ['mobile'],
		//导入验证银行卡号
		'import_bank_account' => ['bank_account'],
		//导入验证开户银行
		'import_bank' => ['bank'],
		//导入验证银行行号
		'import_bank_number' => ['bank_number'],
	];
		
}
